# nlp_architect.models.temporal_convolutional_network.TCN¶

class nlp_architect.models.temporal_convolutional_network.TCN(max_len, n_features_in, hidden_sizes, kernel_size=7, dropout=0.2)[source]

This class defines core TCN architecture. This is only the base class, training strategy is not implemented.

__init__(max_len, n_features_in, hidden_sizes, kernel_size=7, dropout=0.2)[source]
To use this class,
1. Inherit this class
2. Define the training losses in build_train_graph()
3. Define the training strategy in run()
4. After the inherited class object is initialized, call build_train_graph followed by run
Parameters: max_len – Maximum length of sequence n_features_in – Number of input features (dimensions) hidden_sizes – Number of hidden sizes in each layer of TCN (same for all layers) kernel_size – Kernel size of convolution filter (same for all layers) dropout – Dropout, fraction of activations to drop

Methods

 __init__(max_len, n_features_in, hidden_sizes) To use this class, build_network_graph(x[, last_timepoint]) Given the input placeholder x, build the entire TCN graph :param x: Input placeholder :param last_timepoint: Whether or not to select only the last timepoint to output build_train_graph(*args, **kwargs) Placeholder for defining training losses and metrics calculate_receptive_field() Returns: run(*args, **kwargs) Placeholder for defining training strategy
build_network_graph(x, last_timepoint=False)[source]

Given the input placeholder x, build the entire TCN graph :param x: Input placeholder :param last_timepoint: Whether or not to select only the last timepoint to output

Returns: output of the TCN
build_train_graph(*args, **kwargs)[source]

Placeholder for defining training losses and metrics

calculate_receptive_field()[source]

Returns:

run(*args, **kwargs)[source]

Placeholder for defining training strategy